package org.springframework;

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ResourceBundleMessageSource;

import java.util.Locale;

public class MessageSourceTest {

	Logger log = LoggerFactory.getLogger(ResourceTest.class);


	@Test
	public void testMessageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames("i18n/message");
		messageSource.setDefaultEncoding("UTF-8");
		// 获取国际化后的消息
		log.info(messageSource.getMessage("name", new Object[]{"hello"},
				Locale.US));

	}

}
